import type { IRole } from "~/types/manage/system/role";
import { request } from "~/utils/http";
import type { IPermission } from "../login/type";

export const apiRolesList = (): Promise<IRole[]> => request.get("/roles/list");

export const apiRolePermissions = (roleId: number): Promise<IPermission[]> =>
  request.get(`/roles/${roleId}/permissions`);

export const apiModifyRoleWithPermissions = (data: {
  role: Partial<IPermission>;
  permissionIds: number[];
}) => request.post(`/roles/modify`, data);
